<template>
	<custom-page title="上报记录" backgroundColor="#F9F9F9">
		<template #page>
			<common-list-view class="list-view" :enableLoadMore="true" :enableRefresh="true"
				@listinit="onListInit($event)" :hasNoDataHolder="true">
				<template #content='{datas}'>
					<view class="record-item" v-for="(item, index) in datas" @click="recordItemClick(item)">
						<view class="title-row">
							<view class="title">{{item.createTime}}</view>
							<view class="status">{{item.allegeStateDesc}}</view>
						</view>
						<view class="content">{{item.abnormalTypeDesc}}</view>
						<view class="user">上报人员：{{item.allegeUserTypeDesc}}</view>
					</view>
				</template>
			</common-list-view>
		</template>
	</custom-page>
</template>

<script>
	export default {
		data() {
			return {
				orderNo: '',
			}
		},
		onLoad(val) {
			this.orderNo = val.orderNo
			console.log("this.orderNo: " + JSON.stringify(this.orderNo));
		},
		methods: {
			onListInit(event) {
				event.target.loadPageData = ({
					start,
					pageSize,
					showLoading = false
				}) => {
					let params = {
						current: start,
						pageSize: pageSize,
						orderNo: this.orderNo,
					}
					return this.requestCenter.getAbnormalOrderList(params)
						.then(res => {
							return Promise.resolve({
								curPage: start,
								pageCount: res.pages || 1,
								datas: res.records || []
							})
						})
				}
			},
			
			//上报记录点击
			recordItemClick(item){
				uni.navigateTo({
					url: '/pages/order-report-detail/order-report-detail?id=' + item.id
				})
			}
		}
	}
</script>

<style scoped lang="less">
	.record-item{
		width: 100%;
		padding: 0 32rpx 32rpx 32rpx;
		box-sizing: border-box;
		background-color: white;
		margin-top: 16rpx;
		.title-row{
			height: 88rpx;
			line-height: 88rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: space-between;
			border-bottom: solid 1rpx #F5F5F5;
			.title{
				font-size: 28rpx;
				color: #585F70;
			}
			.status{
				font-size: 28rpx;
				color: #01CBFF;
			}
		}
		.content{
			font-size: 32rpx;
			color: #021624;
			font-weight: 500;
			line-height: 48rpx;
			margin-top: 32rpx;
		}
		.user{
			font-size: 28rpx;
			color: #021624;
			line-height: 40rpx;
		}
	}
</style>
